package com.huawei.java.main.inputentity;

public class ServerType {
    private String serverType;//型号
    private int CPU;
    private int memory;
    private int hardWareCost;
    private int dailyCost;
    private int costPerformance;//性价比
    private double cpuAndMemRatio;//核内比

    public ServerType(String serverType, int CPU, int memory, int hardWareCost, int dailyCost) {
        this.serverType = serverType;
        //注意cpu和内存资源在两个节点是均匀分配的
        this.CPU = CPU;
        this.memory = memory;
        this.hardWareCost = hardWareCost;
        this.dailyCost = dailyCost;
        //计算性价比，计算公式：
        //(硬件成本/CPU核数)核心数/（内存数+核心数）+
        //（硬件成本/内存大小） 内存数/（内存数+核心数）
        this.costPerformance=(hardWareCost/CPU)*CPU/(memory+CPU)+(hardWareCost/memory)*memory/(memory+CPU);

        this.cpuAndMemRatio=(double) CPU/memory;
    }

    public int getCostPerformance() {
        return costPerformance;
    }

    public void setCostPerformance(int costPerformance) {
        this.costPerformance = costPerformance;
    }

    @Override
    public String toString() {
        return "Server{" +
                "serverType='" + serverType + '\'' +
                ", CPU=" + CPU +
                ", memory=" + memory +
                ", hardWareCost=" + hardWareCost +
                ", dailyCost=" + dailyCost +
                ", costPerformance=" + costPerformance +
                ", cpuAndMemRatio=" + cpuAndMemRatio +
                "}\n";
    }

    public String getServerType() {
        return serverType;
    }

    public void setServerType(String serverType) {
        this.serverType = serverType;
    }

    public int getCPU() {
        return CPU;
    }

    public void setCPU(int CPU) {
        this.CPU = CPU;
    }

    public int getMemory() {
        return memory;
    }

    public void setMemory(int memory) {
        this.memory = memory;
    }

    public int getHardWareCost() {
        return hardWareCost;
    }

    public void setHardWareCost(int hardWareCost) {
        this.hardWareCost = hardWareCost;
    }

    public int getDailyCost() {
        return dailyCost;
    }

    public void setDailyCost(int dailyCost) {
        this.dailyCost = dailyCost;
    }

    public double getCpuAndMemRatio() {
        return cpuAndMemRatio;
    }

    public void setCpuAndMemRatio(double cpuAndMemRatio) {
        this.cpuAndMemRatio = cpuAndMemRatio;
    }
}
